package com.ghost.manager
{
	import com.ghost.event.SocketEvent;
	import com.ghost.view.pop.pack.Pack;
	import com.ghost.view.pop.pack.Pack_cell;
	import com.ghost.view.pop.pack.Pack_content;

	public class Pack_manager
	{
		private static var instance:Pack_manager;
		public static function getInstance():Pack_manager
		{
			if(instance == null)
			{
				instance = new Pack_manager();
			}
			return instance;
		}
		public var pack_main:Pack;//背包
		public var current_tab:int=0;//当前标签
		public var current_cell_num:int;//当前cell的序号
		public var current_cell:Pack_cell;//当前pack_cell
		public var content_v:Vector.<Pack_content>;
		public var pack_data_v:Vector.<Vector.<Array>>;
		public function Pack_manager()
		{
			pack_main = new Pack();
			pack_main.addEventListener(SocketEvent.REC_DATA_EVENT,rec_Handler);
		}
		//从后台获取背包相关数据
		private function rec_Handler(e:SocketEvent):void
		{
			
		}
		public function parse_data():void
		{
			var l:int = pack_data_v.length;
			var i:int=0;
			for(;i<l;i++)
			{
				content_v[i].data_v = pack_data_v[i];
			}
		}
		public function change_data(...args):void
		{
			var l:int = args.length;
			var i:int = 0;
			for(;i<l;i++)
			{
				content_v[current_tab].data_v[Pack_cell(args[i]).data_num][0]=content_v[current_tab].data_v[Pack_cell(args[i]).cell_num]
			}
		}
	}
}